package com.htl.io.字节流;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

/**
 *  文本类型的复制
 */

public class 文件复制 {
    public static void main(String[] args) throws Exception{
        // 文件复制
        // java1/test.txt 复制到  java2/test.txt
        // InputStream
        InputStream inputStream = new FileInputStream("D:\\Project\\IDEA_project\\java_note\\src\\com\\htl\\io\\java1\\test.txt");
        // OutputStream
        OutputStream outputStream = new FileOutputStream("D:\\Project\\IDEA_project\\java_note\\src\\com\\htl\\io\\java2\\test2.txt");
        int temp = 0;
        // 读数据
        while ((temp = inputStream.read()) != -1){
            // 写数据
            outputStream.write(temp);
        }
        outputStream.close();
        inputStream.close();
    }
}

